﻿using FluentValidation;
using IT.CMS.Web.Areas.Administration.Models.Sites;
using IT.CMS.Services.Localization;

namespace IT.CMS.Web.Areas.Administration.Validators.Sites
{
    public class SiteValidator : AbstractValidator<SiteModel>
    {
        public SiteValidator(ILocalizationService localizationService)
        {
            RuleFor(x => x.Name)
                .NotNull()
                .WithMessage(localizationService.GetResource("Admin.Configuration.Sites.Fields.Name.Required"));
            RuleFor(x => x.Url)
                .NotNull()
                .WithMessage(localizationService.GetResource("Admin.Configuration.Sites.Fields.Url.Required"));
        }
    }
}